<style scoped lang="less">
</style>
<template>
	<div class="plan-details">
		<el-form label-width="150px">
			<el-form-item label="检查任务：">{{data.taskName}}</el-form-item>
			<el-form-item label="计划概要：">{{data.brief}}</el-form-item>
			<el-form-item label="检查周期：">{{data.checkCycle}}</el-form-item>
			<el-form-item label="检查时间：">{{data.starttime}} - {{data.endtime}}</el-form-item>
			<el-form-item label="检查日期：">{{data.startdate}} - {{data.enddate}}</el-form-item>
			<el-form-item label="不检查日期：">{{data.nocheckWeekday || '-'}}</el-form-item>
			<el-form-item label="检查人员：">{{data.checkPersonName}}</el-form-item>
			<el-form-item label="巡检点详情：">{{data.brief}}</el-form-item>
		</el-form>
		<el-form :inline="true" class="filter-blk mt-20">
			<el-form-item label="日期">
				<el-date-picker
			      v-model="dateRange"
			      type="daterange"
			      range-separator="-"
			      start-placeholder="开始日期"
			      end-placeholder="结束日期"
			      format="yyyy-MM-dd"
			      value-format="yyyy-MM-dd">
			    </el-date-picker>
			</el-form-item>
		</el-form>
		<el-table 
			class="mt-20"
			:data="data.list" 
			style="width: 100%"
			v-loading="loading">
		    <el-table-column prop="state" label="巡检状态"></el-table-column>
		    <el-table-column prop="brief" label="巡检时间">
		    	<template slot-scope="scope">
		    		{{scope.row.checktime}}
		    	</template>
		    </el-table-column>
		    <el-table-column prop="brief" label="完成时间">
		    	<template slot-scope="scope">
		    		{{scope.row.completetime}}
		    	</template>
		    </el-table-column>
		</el-table>
	</div>
</template>
<script>
export default {
	name: 'PlanDetail',
	props: {
		id: {
			type: String,
			default: ''
		},
		rfid: {
			type: String,
			default: ''
		},
		startTime: {
			type: String,
			default: ''
		},
		endTime: {
			type: String,
			default: ''
		},
	},
	components: {},
	watch: {
		dateRange (value) {
			this.filterForm.queryStarttime = value[0]
			this.filterForm.queryEndtime = value[1]
			this.getData()
		},
	},
	data () {
		return {
			filterForm: {
				queryStarttime: this.startTime,
				queryEndtime: this.endTime
			},
			dateRange:[this.utils.getCurrentDate(),this.utils.getCurrentDate()],
			planList: [],
			data:{},
			loading: false
		}
	},
	methods: {
		getData () {
			this.loading = true
			let params = Object.assign({
				rfid: this.rfid,
				id: this.id
			},this.filterForm)
			this.$get('/check/checkaddrRecord/planDetail', params).then(res => {
				this.loading = false
				this.data = res.data
				this.planList = this.data.planList
            }, (err) =>{
            	this.loading = false
            	this.$message.error(err.msg)
            })
		},
		detailAction () {}
	},
	created () {
		if(this.startTime){
			this.dateRange[0] = this.startTime
		}
		if(this.endTime){
			this.dateRange[1] = this.endTime
		}
		this.getData()
	},
}
</script>